<nz-spin *ngIf="isLoading" class="modal-spin"></nz-spin>
<form nz-form *ngIf="!isLoading" [formGroup]="validateForm" (ngSubmit)="submitForm()">
  <nz-form-item>
    <nz-form-label [nzSpan]="4" nzRequired nzFor="name">姓名</nz-form-label>
    <nz-form-control [nzSpan]="20" [nzValidateStatus]="validateForm.controls['name']">
      <input type="text" nz-input formControlName="name" placeholder="姓名" readonly>
      <nz-form-explain *ngIf="validateForm.get('name').dirty && validateForm.get('name').hasError('required')">请输入姓名</nz-form-explain>
      <nz-form-explain *ngIf="validateForm.get('name').dirty && validateForm.get('name').hasError('maxlength')">不能超过30个字</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="4" nzRequired nzFor="parentId">直接推荐人</nz-form-label>
    <nz-form-control [nzSpan]="20" [nzValidateStatus]="validateForm.controls['parentId']">
      <nz-select formControlName="parentId" [nzPlaceHolder]="'直接推荐人'" [nzServerSearch]="true" [nzShowSearch]="true" (nzOnSearch)="onSearch($event)" [nzAllowClear]="true">
        <ng-container *ngFor="let option of fansList">
          <nz-option *ngIf="!loadingOption" [nzValue]="option.id" [nzLabel]="option.name"></nz-option>
        </ng-container>
        <nz-option *ngIf="loadingOption" nzDisabled nzCustomContent>
          <i nz-icon type="loading" class="loading-icon"></i> 搜索中
        </nz-option>
      </nz-select>
      <nz-form-extra style="color: orange;padding-top: 10px;">说明：修改直接推荐人,将修改以下关系，请确认后修改<br/>
                1.删除原上级及其所有上级 与 调整用户及调整用户的所有下级的关系<br/>
                2.同时建立新上级及其所有上级 与 调整用户及调整用户的所有下级的关系<br/>
                3.同时可能修改调整用户及调整用户的星创股东归属关系
      </nz-form-extra>
      <nz-form-explain *ngIf="validateForm.get('parentId').dirty && validateForm.get('parentId').hasError('required')">请选择直接推荐人</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <div class="modal-footer">
    <button nz-button type="button" (click)="close()">关闭</button>
    <button nz-button type="submit" [nzType]="'primary'" >保存</button>
  </div>
</form>
